home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / lib / partman / check.d / 05proper_mountpoints < prev    next >
Text File  |  2009-10-28  |  2KB  |  94 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. # At least one file system to mount on /
  6. no_root () {
  7.     mountpoints=$(
  8.         for i in /lib/partman/fstab.d/*; do
  9.             [ -x "$i" ] || continue
  10.             $i
  11.         done |
  12.         while read fs mp type options dump pass; do
  13.             echo $mp
  14.         done
  15.     )
  16.  
  17.     for mp in $mountpoints; do
  18.         if [ "$mp" = / ]; then
  19.             return 0
  20.         fi
  21.     done
  22.  
  23.     db_capb align
  24.     db_input critical partman-target/no_root || true
  25.     db_go || true
  26.     db_capb backup align
  27.     exit 1
  28. }
  29.  
  30. # No two file systems with one and the same mount point
  31. same_mountpoints () {
  32.     mountpoints=$(
  33.         for i in /lib/partman/fstab.d/*; do
  34.             [ -x "$i" ] || continue
  35.             $i
  36.         done |
  37.         while read fs mp type options dump pass; do
  38.             case "$mp" in
  39.                 (/*)
  40.                 echo $mp,$fs;;
  41.             esac
  42.         done |
  43.         sort
  44.     )
  45.  
  46.     oldmp=' '
  47.     for x in $mountpoints; do
  48.         mp=${x%,*}
  49.         fs=${x##*,}
  50.         if [ "$mp" = "$oldmp" ]; then
  51.             db_subst partman-target/same_mountpoint PART1 $(humandev $oldfs)
  52.             db_subst partman-target/same_mountpoint PART2 $(humandev $fs)
  53.             db_subst partman-target/same_mountpoint MOUNTPOINT "$mp"
  54.             db_capb align
  55.             db_input critical partman-target/same_mountpoint || true
  56.             db_go || true
  57.             db_capb backup align
  58.             exit 1
  59.         else
  60.             oldmp="$mp"
  61.             oldfs="$fs"
  62.         fi
  63.     done
  64. }
  65.  
  66. # Some directories must be on the root file system
  67. must_be_on_root () {
  68.     mountpoints=$(
  69.         for i in /lib/partman/fstab.d/*; do
  70.             [ -x "$i" ] || continue
  71.             $i
  72.         done |
  73.         while read fs mp type options dump pass; do
  74.             echo $mp
  75.         done
  76.     )
  77.  
  78.     for mp in $mountpoints; do
  79.         case $mp in
  80.             /bin|/etc|/lib*|/media|/sbin)
  81.             db_subst partman-target/must_be_on_root MOUNTPOINT "$mp"
  82.             db_capb align
  83.             db_input critical partman-target/must_be_on_root || true
  84.             db_go || true
  85.             db_capb backup align
  86.             exit 1
  87.         esac
  88.     done
  89. }
  90.  
  91. no_root
  92. same_mountpoints
  93. must_be_on_root
  94.